﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wilson/MP/Base.Master" AutoEventWireup="true" CodeBehind="ArticleEdit.aspx.cs" Inherits="WebsiteAdmin.Wilson.AboutUs.ArticleEdit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head_Title" runat="server">介绍编辑 - 介绍</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head_Meta" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Head_Css" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Head_Script" runat="server">
    <script type="text/javascript" src="/CKEditor/CKEditor.js"></script>
	<script type="text/javascript" src="/CKFinder/CKFinder.js"></script>
    <script type="text/javascript" src="/Script/Mootools.Smoothbox.js"></script>
<script type="text/javascript" language="javascript">
    var MenuViewID = 5;
    Array.implement({
        getFirstRadio: function() {
            if (this.length == 0) {
                return null;
            }
            return this[0];
        }
    });
    window.addEvent('domready', function() {
        if (typeof (CKEDITOR) == 'undefined' || typeof (CKFinder) == 'undefined') {
            alert('加载CKEditor或CKFinder失败');
        } else {
            CKFinder.setupCKEditor(null, '/CKFinder/');
            CKEDITOR.replace('txbNotesContent');
        }

        $('submitbtn').addEvent('click', function() {
            Submit();
        });
    });
    
    function getContents(e) {
			var oEditor = CKEDITOR.instances[e];
			if (oEditor != null) {
				return(oEditor.getData());
			} else {
				return "";
			}
	}
		
    function Submit() {
        var txbNotesTitle = $('txbNotesTitle').get('value').trim();
        if (txbNotesTitle.length == 0) {
            alert('介绍标题错误');
            return false;
        }
        var txbUrlName = $('txbUrlName').get('value').trim();
        var txbKeywords = $('txbKeywords').get('value').trim();
        var txbDescription = $('txbDescription').get('value').trim();
        var txbSortOrder = $('txbSortOrder').get('value').trim().toInt();
        if (isNaN(txbSortOrder)) {
            alert('必须是整数');
            return false;
        }
        var txbNotesContent = getContents('txbNotesContent').trim();

        Update(
        txbNotesTitle,
        txbUrlName,
        txbKeywords,
        txbDescription,
        txbSortOrder,
        txbNotesContent);
    }

    function Update(txbNotesTitle,
        txbUrlName,
        txbKeywords,
        txbDescription,
        txbSortOrder,
        txbNotesContent) {

        new Request.JSON({
            method: 'post',
            url: 'Handler/Update.ashx',
            data: {
                PKID:<%=pkid %>,
                NotesTitle: txbNotesTitle,
                UrlName: txbUrlName,
                Keywords: txbKeywords,
                Description: txbDescription,
                SortOrder: txbSortOrder,
                IsFoot: 1,
                IsDisplay: 1,
                NotesContent: txbNotesContent
            },
            noCache: true,
            onSuccess: function(data, text) {
                if (data.Done == 'Success') { 
                    
                    if(confirm('修改成功，返回列表？'))
                    {
                        document.location.href = '/Wilson/AboutUs/ArticleList.aspx';
                    };
                    LightBox.remove();
                }
                else
                {
                    alert('修改失败');
                    LightBox.remove();
                }
            },
            onFailure: function(xhr) {
                alert(xhr.statusText);
                LightBox.remove();
            }
        }).send();
    }
    
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Body_Top" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Body_Content" runat="server">
    <div class="infobox">
        <h3>
        <span>介绍编辑</span>
			<a href="/Wilson/AboutUs/ArticleList.aspx" class="back action">返回介绍列表</a>
        </h3>
        <div class="pd05">
        <form id="myForm" action="">
		    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
		        <tr>
            		<td align="right" width="100"><span class="Need">介绍标题：</span></td>
            		<td>
            			<input name="txbNotesTitle" type="text" id="txbNotesTitle" maxlength="20" size="10" value="<%=notesTitle %>" />
            			<i>限10个汉字</i>
            		</td>
				</tr>
				<tr>
            		<td align="right" width="100"><span class="Need">显示链接：</span></td>
            		<td>
            			<input name="txbUrlName" type="text" id="txbUrlName" maxlength="20" size="20" value="<%=urlName %>" /><i>.html
            			限20个字符，例 service、fuwu</i>
            		</td>
				</tr>
				<tr>
            		<td align="right" width="100"><span class="Need">关键词：</span></td>
            		<td>
            			<input name="txbKeywords" type="text" id="txbKeywords" maxlength="50" size="50" value="<%=keywords %>"/>
            		</td>
				</tr>
				<tr>
            		<td align="right" width="100"><span class="Need">简介：</span></td>
            		<td>
            			<textarea name="txbDescription" rows="3" cols="20" id="txbDescription"><%=description %></textarea>
            		</td>
				</tr>
				<tr>
            		<td align="right" width="100"><span class="Need">显示排序：</span></td>
            		<td>
            			<input name="txbSortOrder" type="text" id="txbSortOrder" maxlength="3" size="5" value="<%=displayOrder%>" />
            			<i>请输入数字</i>
            		</td>
				</tr>
				<!--<tr>
					<td align="right">底部导航：</td>
					<td>
						<input type="radio" name="txbIsFoot" id="txbIsFootT" value="1" <% if(isFoot == 1){ Response.Write("checked='checked'");}%>/>
						<label for="txbIsFootT">显示</label>
						&nbsp;&nbsp;&nbsp;
						<input type="radio" name="txbIsFoot" id="txbIsFootF" value="0" <% if(isFoot == 0){ Response.Write("checked='checked'");}%> />
						<label for="txbIsFootF">不显示</label>
					</td>
				</tr>-->
				<!--<tr>
					<td align="right">是否显示：</td>
					<td>
						<input type="radio" name="txbIsDisplay" id="txbIsDisplayT" value="1" <% if(isDisplay == 1){ Response.Write("checked='checked'");}%> />
						<label for="txbIsDisplayT">显示</label>
						&nbsp;&nbsp;&nbsp;
						<input type="radio" name="txbIsDisplay" id="txbIsDisplayF" value="0" <% if(isDisplay == 0){ Response.Write("checked='checked'");}%>/>
						<label for="txbIsDisplayF">不显示</label>
					</td>
				</tr>-->			
				<tr>
					<td align="right"><span class="Need">介绍内容：</span></td>
					<td>
						<textarea name="txbNotesContent" rows="14" cols="20" id="txbNotesContent"><%=notesContent%></textarea>
						<i>限2000汉字(4000字符)</i>
					</td>
				</tr>
		    </table>
		    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
				<tr>
					<td width="100" height="40">&nbsp;</td>
					<td>
						<input id="submitbtn" type="button" value="提交" class="btn" />
						<input type="reset" value="重置" class="btn" />
					</td>
				</tr>
			</table>
		</form>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="Body_Foot" runat="server">
</asp:Content>
